package com.atxwq.shop.manager.serivce.impl;

import com.atxwq.shop.manager.mapper.ProductSpecMapper;
import com.atxwq.shop.manager.serivce.ProductSpecService;
import com.atxwq.shop.model.entity.product.Brand;
import com.atxwq.shop.model.entity.product.ProductSpec;
import com.atxwq.shop.model.vo.common.Result;
import com.atxwq.shop.model.vo.common.ResultCodeEnum;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description 商品规格服务实现类
 * @Date 2025/5/14 16:48
 * @Created by 12336
 */

@Service
public class ProductSpecServiceImpl implements ProductSpecService {

    @Autowired
    private ProductSpecMapper productSpecMapper;

    @Override
    public PageInfo<ProductSpec> findByPage(Integer page, Integer limit) {
        PageHelper.startPage(page, limit);
        List<ProductSpec> brandList = productSpecMapper.findByPage();
        return new PageInfo<>(brandList);
    }

    @Override
    public void save(ProductSpec productSpec) {
        productSpecMapper.save(productSpec);
    }

    @Override
    public void update(ProductSpec productSpec) {
        productSpecMapper.update(productSpec);
    }

    @Override
    public void delete(Long id) {
        productSpecMapper.delete(id);
    }

    /**
     * 查询所有商品规格
     * @return
     */
    @Override
    public List<ProductSpec> findAll() {
       List<ProductSpec> list =  productSpecMapper.findAll();
      return list;
    }
}
